package com.lmt.ymcc.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "course",type = "_doc")
public class CourseDoc {
    @Id//使用id的值 作为我的当前Document的ID
    private Long id;

    // 指定name列的 类型是text  创建和搜索索引的分词器 IK
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    @Field(type = FieldType.Keyword)
    private String gradeName;

    @Field(type = FieldType.Keyword)
    private String forUser;//适用人群

    @Field(type = FieldType.Long)
    private Long courseTypeId;//课程分类ID

    @Field(type = FieldType.Keyword)
    private String courseTypeName;//课程分类名字

    @Field(type = FieldType.Date)
    private Date startTime;

    @Field(type = FieldType.Date)
    private Date endTime;

    @Field(type = FieldType.Keyword)
    private String pic;//封面

    @Field(type = FieldType.Integer)
    private Integer totalMinute;//总时长

    @Field(type = FieldType.Date)
    private Date onlineTime;//上架时间

    @Field(type = FieldType.Integer)
    private Integer chapterCount;//章节数

    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String teacherNames;//讲师，逗号分隔多个

    @Field(type = FieldType.Keyword)
    private String chargeName;//收费规则   1免费，2收费

    @Field(type = FieldType.Double)
    private BigDecimal price;

    @Field(type = FieldType.Double)
    private BigDecimal priceOld;

    @Field(type = FieldType.Integer)
    private Integer validDays;//可看天数

    @Field(type = FieldType.Integer)
    private Integer saleCount;//销量

    @Field(type = FieldType.Integer)
    private Integer viewCount;//浏览量

    @Field(type = FieldType.Integer)
    private Integer commentCount;//评论数
}